import process from 'process'
import path from 'path'
import fs from 'fs'

export class IParams {
    pipelineID!: number

    pipelineName!: string

    buildNumber?: number

    workSpace!: string

    projectDir!: string

    buildJobID!: number

    appStackCloudRolloutToken!: string

    appStackOrgId!: string

    appStackCloudRolloutTimeStamp!: string

    appStackUserId!: string

    appStackDomain!: string

    appStackCookie!: string

}

export function getParams(): IParams {
    let params = new IParams()
    params.pipelineID = Number(process.env.PIPELINE_ID)
    params.pipelineName = process.env.PIPELINE_NAME as string
    params.buildNumber = Number(process.env.BUILD_NUMBER)
    params.workSpace = process.env.WORK_SPACE as string
    params.projectDir = process.env.PROJECT_DIR as string
    params.buildJobID = Number(process.env.BUILD_JOB_ID)
    params.appStackCloudRolloutToken = process.env.APPSTACK_CLOUD_ROLLOUT_TOKEN as string
    params.appStackOrgId = process.env.APPSTACK_ORG_ID as string
    params.appStackCloudRolloutTimeStamp = process.env.APPSTACK_CLOUD_ROLLOUT_TIMESTAMP as string
    params.appStackUserId = process.env.APPSTACK_USER_ID as string
    params.appStackDomain = process.env.APPSTACK_DOMAIN as string
    params.appStackCookie = process.env.APPSTACK_COOKIE as string
    return params
}